﻿using UnityEditor;

[CustomEditor(typeof(ScrollSelect), true)]
public class ScrollSelectEditor : Editor
{
    private SerializedProperty _content;
    private SerializedProperty _axialType;
    private SerializedProperty _defaultPageIndex;
    private SerializedProperty _smooth;
    private SerializedProperty _onValueChanged;
    private SerializedProperty _onPageChanged;

    private void OnEnable()
    {
        _content = serializedObject.FindProperty("m_Content");
        _axialType = serializedObject.FindProperty("axialType");
        _defaultPageIndex = serializedObject.FindProperty("defaultPageIndex");
        _smooth = serializedObject.FindProperty("smooth");
        _onValueChanged = serializedObject.FindProperty("m_OnValueChanged");
        _onPageChanged = serializedObject.FindProperty("onPageChanged");
    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.PropertyField(_content);
        EditorGUILayout.PropertyField(_axialType);
        EditorGUILayout.PropertyField(_defaultPageIndex);
        EditorGUILayout.PropertyField(_smooth);
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(_onValueChanged);
        EditorGUILayout.PropertyField(_onPageChanged);
        serializedObject.ApplyModifiedProperties();
    }
}